package ys.ewp.dto;

import java.util.Date;

import ys.ewp.po.Account;

public class AccountDto{
	
	//账户ID
	private Integer id;
	//账号
	private String accountCode;
	//账户角色
	private Integer role;
	//登陆系统时的时间
	private Date loginTime;
	//所属员工ID
	private Integer empId;
	//所属员工姓名
	private String empRealName;
	//创建时间
	private Date dateCreated;
	//更新时间
	private Date dateUpdated;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getAccountCode() {
		return accountCode;
	}
	public void setAccountCode(String accountCode) {
		this.accountCode = accountCode;
	}
	public Integer getRole() {
		return role;
	}
	public void setRole(Integer role) {
		this.role = role;
	}
	public Date getLoginTime() {
		return loginTime;
	}
	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}
	public Integer getEmpId() {
		return empId;
	}
	public void setEmpId(Integer empId) {
		this.empId = empId;
	}
	public String getEmpRealName() {
		return empRealName;
	}
	public void setEmpRealName(String empRealName) {
		this.empRealName = empRealName;
	}
	public Date getDateCreated() {
		return dateCreated;
	}
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	public Date getDateUpdated() {
		return dateUpdated;
	}
	public void setDateUpdated(Date dateUpdated) {
		this.dateUpdated = dateUpdated;
	}
	
	/**
	 * @功能 根据账户PO对象获得账户DTO对象
	 */
	public static AccountDto getDtoByPo(Account acc){
		AccountDto accDto = new AccountDto();
		
		accDto.setId(acc.getId());
		accDto.setAccountCode(acc.getAccountCode());
		accDto.setRole(acc.getRole());
		accDto.setLoginTime(new Date());
		accDto.setEmpId(acc.getEmployee().getId());
		accDto.setEmpRealName(acc.getEmployee().getRealName());
		accDto.setDateCreated(acc.getDateCreated());
		accDto.setDateUpdated(acc.getDateUpdated());
		
		return accDto;
	}
	
}
